<?php
namespace Library;
class Zhouyiqigua{
    public function zyqgInterface($guaxiang,$sizhu,$guaName1=null,$guaName2=null){//接口逻辑
        $arryouhun=array('火地晋','雷山小过','天水讼','泽风大过','山雷颐','地火明夷','风山渐','水天需');//游魂
        $arrguihun=array('火天大有','雷泽归妹','天火同人','泽雷随','山风蛊','地水师','风山渐','水地比');//归魂
        $arrliuchong=array('乾为天','兑为泽','离为火','震为雷','巽为风','坎为水','艮为山','坤为地','天雷无妄','雷天大壮');//六冲
        $arrliuhe=array('天地否','水泽节','山火贲','雷地豫','火山旅','地雷复','地天泰','泽水困');//六合
        $bengua=$guaxiang;$biangua=$guaxiang;
        for($i=1;$i<=6;$i++){
            if($guaxiang[$i]==3||$guaxiang[$i]==1){$bengua[$i]=1;}else{$bengua[$i]=2;}
        }
        for($i=1;$i<=6;$i++){
            if($guaxiang[$i]==3){$biangua[$i]='2';}else if($guaxiang[$i]==4){$biangua[$i]='1';}
        }
        $yao1=$bengua[1];$yao2=$bengua[2];$yao3=$bengua[3];$yao4=$bengua[4];$yao5=$bengua[5];$yao6=$bengua[6];
        if($yao4==1&&$yao5==1&&$yao6==1){$sgua='qiantian';
        }else if($yao4==1&&$yao5==1&&$yao6==2){$sgua='duize';
        }else if($yao4==1&&$yao5==2&&$yao6==1){$sgua='lihuo';
        }else if($yao4==1&&$yao5==2&&$yao6==2){$sgua='zhenlei';
        }else if($yao4==2&&$yao5==1&&$yao6==1){$sgua='xunfeng';
        }else if($yao4==2&&$yao5==1&&$yao6==2){$sgua='kanshui';
        }else if($yao4==2&&$yao5==2&&$yao6==1){$sgua='genshan';
        }else if($yao4==2&&$yao5==2&&$yao6==2){$sgua='kundi';}

        if($yao1==1&&$yao2==1&&$yao3==1){$xgua='乾天';
        }else if($yao1==1&&$yao2==1&&$yao3==2){$xgua='兑泽';
        }else if($yao1==1&&$yao2==2&&$yao3==1){$xgua='离火';
        }else if($yao1==1&&$yao2==2&&$yao3==2){$xgua='震雷';
        }else if($yao1==2&&$yao2==1&&$yao3==1){$xgua='巽风';
        }else if($yao1==2&&$yao2==1&&$yao3==2){$xgua='坎水';
        }else if($yao1==2&&$yao2==2&&$yao3==1){$xgua='艮山';
        }else if($yao1==2&&$yao2==2&&$yao3==2){$xgua='坤地';}

        if($guaName1){//卦名起卦
            $sxguaArr=M()->query("select * from tb_shangxiaguacx where id>0");
            foreach($sxguaArr as $key=>$value){
                foreach($value as $k=>$v){
                    if($v==$guaName1){
                        $sgua=$k;
                        $xgua=$value['name'];
                        switch($sgua){
                            case 'qiantian':$yao4=1;$yao5=1;$yao6=1;break;
                            case 'duize':$yao4=1;$yao5=1;$yao6=2;break;
                            case 'lihuo':$yao4=1;$yao5=2;$yao6=1;break;
                            case 'zhenlei':$yao4=1;$yao5=2;$yao6=2;break;
                            case 'xunfeng':$yao4=2;$yao5=1;$yao6=1;break;
                            case 'kanshui':$yao4=2;$yao5=1;$yao6=2;break;
                            case 'genshan':$yao4=2;$yao5=2;$yao6=1;break;
                            default:$yao4=2;$yao5=2;$yao6=2;
                        }
                        switch($xgua){
                            case '乾天':$yao1=1;$yao2=1;$yao3=1;break;
                            case '兑泽':$yao1=1;$yao2=1;$yao3=2;break;
                            case '离火':$yao1=1;$yao2=2;$yao3=1;break;
                            case '震雷':$yao1=1;$yao2=2;$yao3=2;break;
                            case '巽风':$yao1=2;$yao2=1;$yao3=1;break;
                            case '坎水':$yao1=2;$yao2=1;$yao3=2;break;
                            case '艮山':$yao1=2;$yao2=2;$yao3=1;break;
                            default:$yao1=2;$yao2=2;$yao3=2;
                        }
                        break;
                    }
                }
            }
            $guaxiang=array('',$yao1,$yao2,$yao3,$yao4,$yao5,$yao6);

            $arrbengua=M()->query("select * from tb_zy_lssgua where name='{$guaName1}'");
        }else{
            $benguadata=M()->query("select {$sgua} from tb_shangxiaguacx where name='{$xgua}'");
            $arrbengua=M()->query("select * from tb_zy_lssgua where name='{$benguadata[0][$sgua]}'");
        }
        $arr['guaxiang']=$guaxiang;

        if(array_search($arrbengua[0]['name'],$arryouhun)){
            $arrbengua[0]['name']=$arrbengua[0]['name'].'(游魂)';}
        if(array_search($arrbengua[0]['name'],$arrguihun)){
            $arrbengua[0]['name']=$arrbengua[0]['name'].'(归魂)';}
        if(array_search($arrbengua[0]['name'],$arrliuchong)){
            $arrbengua[0]['name']=$arrbengua[0]['name'].'(六冲)';}
        if(array_search($arrbengua[0]['name'],$arrliuhe)){
            $arrbengua[0]['name']=$arrbengua[0]['name'].'(六合)';}
        $arr['arrbengua']=$arrbengua[0];

        //宫位六亲  金木水火土    $gonweilq=array('','','','','');
        $bengong=mb_substr($arrbengua[0]['gua'],0,1,'utf-8');
        if($bengong=='乾'){$gonweilq=array('兄弟','妻财','子孙','官鬼','父母');
        }else if($bengong=='震'){$gonweilq=array('官鬼','兄弟','父母','子孙','妻财');
        }else if($bengong=='坎'){$gonweilq=array('父母','子孙','兄弟','妻财','官鬼');
        }else if($bengong=='艮'){$gonweilq=array('子孙','官鬼','妻财','父母','兄弟');
        }else if($bengong=='坤'){$gonweilq=array('子孙','官鬼','妻财','父母','兄弟');
        }else if($bengong=='巽'){$gonweilq=array('官鬼','兄弟','父母','子孙','妻财');
        }else if($bengong=='离'){$gonweilq=array('妻财','父母','官鬼','兄弟','子孙');
        }else if($bengong=='兑'){$gonweilq=array('兄弟','妻财','子孙','官鬼','父母');
        }

        if($bengua!=$biangua||$guaName2){//变卦是否执行
            $yao1=$biangua[1];$yao2=$biangua[2];$yao3=$biangua[3];$yao4=$biangua[4];$yao5=$biangua[5];$yao6=$biangua[6];
            $bguaxiang=array('',$yao1,$yao2,$yao3,$yao4,$yao5,$yao6);
            $arr['bguaxiang']=$bguaxiang;
            if($yao4==1&&$yao5==1&&$yao6==1){$sgua='qiantian';
            }else if($yao4==1&&$yao5==1&&$yao6==2){$sgua='duize';
            }else if($yao4==1&&$yao5==2&&$yao6==1){$sgua='lihuo';
            }else if($yao4==1&&$yao5==2&&$yao6==2){$sgua='zhenlei';
            }else if($yao4==2&&$yao5==1&&$yao6==1){$sgua='xunfeng';
            }else if($yao4==2&&$yao5==1&&$yao6==2){$sgua='kanshui';
            }else if($yao4==2&&$yao5==2&&$yao6==1){$sgua='genshan';
            }else if($yao4==2&&$yao5==2&&$yao6==2){$sgua='kundi';}
            if($yao1==1&&$yao2==1&&$yao3==1){$xgua='乾天';
            }else if($yao1==1&&$yao2==1&&$yao3==2){$xgua='兑泽';
            }else if($yao1==1&&$yao2==2&&$yao3==1){$xgua='离火';
            }else if($yao1==1&&$yao2==2&&$yao3==2){$xgua='震雷';
            }else if($yao1==2&&$yao2==1&&$yao3==1){$xgua='巽风';
            }else if($yao1==2&&$yao2==1&&$yao3==2){$xgua='坎水';
            }else if($yao1==2&&$yao2==2&&$yao3==1){$xgua='艮山';
            }else if($yao1==2&&$yao2==2&&$yao3==2){$xgua='坤地';}
            if($guaName2){//卦名起卦
                foreach($sxguaArr as $key=>$value){
                    foreach($value as $k=>$v){
                        if($v==$guaName2){
                            $sgua=$k;
                            $xgua=$value['name'];
                            switch($sgua){
                                case 'qiantian':$yao4=1;$yao5=1;$yao6=1;break;
                                case 'duize':$yao4=1;$yao5=1;$yao6=2;break;
                                case 'lihuo':$yao4=1;$yao5=2;$yao6=1;break;
                                case 'zhenlei':$yao4=1;$yao5=2;$yao6=2;break;
                                case 'xunfeng':$yao4=2;$yao5=1;$yao6=1;break;
                                case 'kanshui':$yao4=2;$yao5=1;$yao6=2;break;
                                case 'genshan':$yao4=2;$yao5=2;$yao6=1;break;
                                default:$yao4=2;$yao5=2;$yao6=2;
                            }
                            switch($xgua){
                                case '乾天':$yao1=1;$yao2=1;$yao3=1;break;
                                case '兑泽':$yao1=1;$yao2=1;$yao3=2;break;
                                case '离火':$yao1=1;$yao2=2;$yao3=1;break;
                                case '震雷':$yao1=1;$yao2=2;$yao3=2;break;
                                case '巽风':$yao1=2;$yao2=1;$yao3=1;break;
                                case '坎水':$yao1=2;$yao2=1;$yao3=2;break;
                                case '艮山':$yao1=2;$yao2=2;$yao3=1;break;
                                default:$yao1=2;$yao2=2;$yao3=2;
                            }
                            break;
                        }
                    }
                }
                $guaxiang=array('',$yao1,$yao2,$yao3,$yao4,$yao5,$yao6);
                $arr['bguaxiang']=$guaxiang;

                $arrbiangua=M()->query("select * from tb_zy_lssgua where name='{$guaName2}'");
            }else{
                $bianguadata=M()->query("select {$sgua} from tb_shangxiaguacx where name='{$xgua}'");
                $arrbiangua=M()->query("select * from tb_zy_lssgua where name='{$bianguadata[0][$sgua]}'");
            }

            if(array_search($arrbiangua[0]['name'],$arryouhun)){
                $arrbiangua[0]['name']=$arrbiangua[0]['name'].'(游魂)';}
            if(array_search($arrbiangua[0]['name'],$arrguihun)){
                $arrbiangua[0]['name']=$arrbiangua[0]['name'].'(归魂)';}
            if(array_search($arrbiangua[0]['name'],$arrliuchong)){
                $arrbiangua[0]['name']=$arrbiangua[0]['name'].'(六冲)';}
            if(array_search($arrbiangua[0]['name'],$arrliuhe)){
                $arrbiangua[0]['name']=$arrbiangua[0]['name'].'(六合)';}
            for($i=1;$i<=6;$i++){
                $datalq=mb_substr($arrbiangua[0]['sxgua'.$i],0,2,'utf-8');
                $datawx=mb_substr($arrbiangua[0]['sxgua'.$i],4,1,'utf-8');
                if($datawx=='金'){$data=str_replace($datalq,$gonweilq[0],$arrbiangua[0]['sxgua'.$i]);
                }else if($datawx=='木'){$data=str_replace($datalq,$gonweilq[1],$arrbiangua[0]['sxgua'.$i]);
                }else if($datawx=='水'){$data=str_replace($datalq,$gonweilq[2],$arrbiangua[0]['sxgua'.$i]);
                }else if($datawx=='火'){$data=str_replace($datalq,$gonweilq[3],$arrbiangua[0]['sxgua'.$i]);
                }else{$data=str_replace($datalq,$gonweilq[4],$arrbiangua[0]['sxgua'.$i]);
                }
                $arrbiangua[0]['sxgua'.$i]=$data;
            }
            $arr['arrbiangua']=$arrbiangua[0];
        }else{
            $arr['arrbiangua']='';
            $arr['bguaxiang']='';
        }
        $rizhux=mb_substr($sizhu[2],0,1,'utf-8');
        if($rizhux=='甲'||$rizhux=='乙'){$arrliushou=array('青龙','朱雀','勾陈','腾蛇','白虎','玄武');
        }else if($rizhux=='丙'||$rizhux=='丁'){$arrliushou=array('朱雀','勾陈','腾蛇','白虎','玄武','青龙');
        }else if($rizhux=='戊'){$arrliushou=array('勾陈','腾蛇','白虎','玄武','青龙','朱雀');
        }else if($rizhux=='己'){$arrliushou=array('腾蛇','白虎','玄武','青龙','朱雀','勾陈');
        }else if($rizhux=='庚'||$rizhux=='辛'){$arrliushou=array('白虎','玄武','青龙','朱雀','勾陈','腾蛇');
        }else{$arrliushou=array('玄武','青龙','朱雀','勾陈','腾蛇','白虎');}
        $arr['arrliushou']=$arrliushou;

        return $arr;
    }

    public function tbssBgData($sizhu,$yysex){//铁版神算八卦数据
        $Gyname=mb_substr($sizhu[0],0,1,'utf-8');$Zyname=mb_substr($sizhu[0],1,1,'utf-8');
        $Gmname=mb_substr($sizhu[1],0,1,'utf-8');$Zmname=mb_substr($sizhu[1],1,1,'utf-8');
        $Gdname=mb_substr($sizhu[2],0,1,'utf-8');$Zdname=mb_substr($sizhu[2],1,1,'utf-8');
        $Ghname=mb_substr($sizhu[3],0,1,'utf-8');$Zhname=mb_substr($sizhu[3],1,1,'utf-8');
        $txGNumArr=array(
            '甲'=>'9','乙'=>'8','丙'=>'7','丁'=>'6','戊'=>'5','己'=>'9','庚'=>'8','辛'=>'7','壬'=>'6','癸'=>'5',
        );
        $txZNumArr=array(
            '子'=>'9','丑'=>'8','寅'=>'7','卯'=>'6','辰'=>'5','巳'=>'4','午'=>'9','未'=>'8','申'=>'7','酉'=>'6','戌'=>'5','亥'=>'4',
        );
        //先天八卦
        if($yysex=='阳男'||$yysex=='阴女'){
            $ZsgNum=($txGNumArr[$Gyname]+$txZNumArr[$Zyname])%8;if($ZsgNum==0)$ZsgNum=8;
            $ZxgNum=($txGNumArr[$Gmname]+$txZNumArr[$Zmname])%8;if($ZxgNum==0)$ZxgNum=8;
        }else{
            $ZsgNum=($txGNumArr[$Gmname]+$txZNumArr[$Zmname])%8;if($ZsgNum==0)$ZsgNum=8;
            $ZxgNum=($txGNumArr[$Gyname]+$txZNumArr[$Zyname])%8;if($ZxgNum==0)$ZxgNum=8;
        }
        $xtTwNumArr=$this->tbssTaowenNum($ZsgNum,$ZxgNum);
        //后天八卦
        $HsgNum=$txGNumArr[$Gdname]+$txZNumArr[$Zdname]-10;$HsgNum=abs($HsgNum);
        $HxgNum=$txGNumArr[$Ghname]+$txZNumArr[$Zhname]-10;$HxgNum=abs($HxgNum);

        $htTwNumArr=$this->tbssTaowenNum($HsgNum,$HxgNum);
        $Arr=array_merge($xtTwNumArr,$htTwNumArr);

        return $Arr;
    }
    public function tbssTaowenNum($sgNum,$xgNum,$typeHg=null){//八卦取条文
        if($sgNum==1||$sgNum=='111'){$sgua='qiantian';$bgSgNum=1;
        }else if($sgNum==2||$sgNum=='112'){$sgua='duize';$bgSgNum=2;
        }else if($sgNum==3||$sgNum=='121'){$sgua='lihuo';$bgSgNum=3;
        }else if($sgNum==4||$sgNum=='122'){$sgua='zhenlei';$bgSgNum=4;
        }else if($sgNum==5||$sgNum=='211'){$sgua='xunfeng';$bgSgNum=5;
        }else if($sgNum==6||$sgNum=='212'){$sgua='kanshui';$bgSgNum=6;
        }else if($sgNum==7||$sgNum=='221'){$sgua='genshan';$bgSgNum=7;
        }else if($sgNum==8||$sgNum=='222'){$sgua='kundi';$bgSgNum=8;
        }

        if($xgNum==1||$xgNum=='111'){$xgua='乾天';$bgXgNum=1;
        }else if($xgNum==2||$xgNum=='112'){$xgua='兑泽';$bgXgNum=2;
        }else if($xgNum==3||$xgNum=='121'){$xgua='离火';$bgXgNum=3;
        }else if($xgNum==4||$xgNum=='122'){$xgua='震雷';$bgXgNum=4;
        }else if($xgNum==5||$xgNum=='211'){$xgua='巽风';$bgXgNum=5;
        }else if($xgNum==6||$xgNum=='212'){$xgua='坎水';$bgXgNum=6;
        }else if($xgNum==7||$xgNum=='221'){$xgua='艮山';$bgXgNum=7;
        }else if($xgNum==8||$xgNum=='222'){$xgua='坤地';$bgXgNum=8;
        }
        if($typeHg==4){
            return array($bgSgNum,$bgXgNum);
        }
        $benguadata=M()->query("select {$sgua} from tb_shangxiaguacx where name='{$xgua}'");
        $arrbengua=M()->query("select name,gua,hugua,sxgua1,sxgua2,sxgua3,sxgua4,sxgua5,sxgua6 from tb_zy_lssgua where name='{$benguadata[0][$sgua]}'");
        if($typeHg==2){
            return $arrbengua[0];
        }
        $huguaS=substr($arrbengua[0]['hugua'],3,3);
        $huguaX=substr($arrbengua[0]['hugua'],0,3);
        if($huguaS=='111'){$HGsgNum=1;$HGsgHtNum=6;
        }else if($huguaS=='112'){$HGsgNum=2;$HGsgHtNum=7;
        }else if($huguaS=='121'){$HGsgNum=3;$HGsgHtNum=9;
        }else if($huguaS=='122'){$HGsgNum=4;$HGsgHtNum=3;
        }else if($huguaS=='211'){$HGsgNum=5;$HGsgHtNum=4;
        }else if($huguaS=='212'){$HGsgNum=6;$HGsgHtNum=1;
        }else if($huguaS=='221'){$HGsgNum=7;$HGsgHtNum=8;
        }else if($huguaS=='222'){$HGsgNum=8;$HGsgHtNum=2;
        }
        if($huguaX=='111'){$HGxgNum=1;$HGxgHtNum=6;
        }else if($huguaX=='112'){$HGxgNum=2;$HGxgHtNum=7;
        }else if($huguaX=='121'){$HGxgNum=3;$HGxgHtNum=9;
        }else if($huguaX=='122'){$HGxgNum=4;$HGxgHtNum=3;
        }else if($huguaX=='211'){$HGxgNum=5;$HGxgHtNum=4;
        }else if($huguaX=='212'){$HGxgNum=6;$HGxgHtNum=1;
        }else if($huguaX=='221'){$HGxgNum=7;$HGxgHtNum=8;
        }else if($huguaX=='222'){$HGxgNum=8;$HGxgHtNum=2;
        }
        if($typeHg==1){//互卦先天数获取
            return array($HGsgNum,$HGxgNum);
        }elseif($typeHg==3){//互卦后天数
            return array($HGsgHtNum,$HGxgHtNum);
        }
        $jcNum=$sgNum.$xgNum.$HGsgNum.$HGxgNum;
        $twNum1=$jcNum+48*2;
        $twNum2=$jcNum+48*4;
        $twNum3=$jcNum+48*8;
        $twNum4=$jcNum+48*16;
        $twNum5=$jcNum-48*2;
        $twNum6=$jcNum-48*4;
        $twNum7=$jcNum-48*8;
        $twNum8=$jcNum-48*16;
        $Arr=array(
            $twNum1,$twNum2,$twNum3,$twNum4,$twNum5,$twNum6,$twNum7,$twNum8
        );
        return $Arr;
    }
    public function tbssBs2Data($sizhu){//八卦加则取数法2
        $txGNumArr=array(
            '甲'=>'1','乙'=>'8','丙'=>'7','丁'=>'2','戊'=>'6','己'=>'3','庚'=>'4','辛'=>'5','壬'=>'1','癸'=>'8',
        );
        $txZNumArr=array(
            '子'=>'6','丑'=>'8','寅'=>'4','卯'=>'4','辰'=>'2','巳'=>'3','午'=>'3','未'=>'7','申'=>'7','酉'=>'1','戌'=>'5','亥'=>'6',
        );
        foreach($sizhu as $key=>$value){
            $Gname=mb_substr($value,0,1,'utf-8');
            $Zname=mb_substr($value,1,1,'utf-8');
            $sgNum=$txGNumArr[$Gname];
            $xgNum=$txZNumArr[$Zname];
            $twData=$this->tbssTaowenNum2($sgNum,$xgNum);
            $Arr[$key]=$twData;
        }
        return $Arr;
    }
    public function tbssTaowenNum2($sgNum,$xgNum,$typeTw=null){//八卦加则取数法2 条文取法
        //dump('gua:'.$sgNum.$xgNum);
        if($sgNum==1){$sgua='qiantian';$qNum=6*1000;$guaSstr='111';
        }else if($sgNum==2){$sgua='duize';$qNum=7*1000;$guaSstr='112';
        }else if($sgNum==3){$sgua='lihuo';$qNum=9*1000;$guaSstr='121';
        }else if($sgNum==4){$sgua='zhenlei';$qNum=3*1000;$guaSstr='122';
        }else if($sgNum==5){$sgua='xunfeng';$qNum=4*1000;$guaSstr='211';
        }else if($sgNum==6){$sgua='kanshui';$qNum=1*1000;$guaSstr='212';
        }else if($sgNum==7){$sgua='genshan';$qNum=8*1000;$guaSstr='221';
        }else if($sgNum==8){$sgua='kundi';$qNum=2*1000;$guaSstr='222';
        }
        if($xgNum==1){$xgua='乾天';$xGuaNum=6; $guaXstr='111';
        }else if($xgNum==2){$xgua='兑泽';$xGuaNum=7;$guaXstr='112';
        }else if($xgNum==3){$xgua='离火';$xGuaNum=9;$guaXstr='121';
        }else if($xgNum==4){$xgua='震雷';$xGuaNum=3;$guaXstr='122';
        }else if($xgNum==5){$xgua='巽风';$xGuaNum=4;$guaXstr='211';
        }else if($xgNum==6){$xgua='坎水';$xGuaNum=1;$guaXstr='212';
        }else if($xgNum==7){$xgua='艮山';$xGuaNum=8;$guaXstr='221';
        }else if($xgNum==8){$xgua='坤地';$xGuaNum=2;$guaXstr='222';
        }

        $jzArr=array(0,30,90,180,300,450,630);
        $yangCount=substr_count($guaSstr.$guaXstr,1);
        $yinCount=substr_count($guaSstr.$guaXstr,2);
        $twNum=$qNum+$jzArr[$yangCount]+$jzArr[$yinCount]-$xGuaNum;
        if($typeTw==1){
            return $twNum;
        }

        $twArr=M()->query("select * from data_tbss where number='{$twNum}'");
        $textData=$twArr[0]['content'];
        $strposNum=strpos($textData,'）');
//        dump($textData);
//        dump($strposNum);
        if($strposNum){$textData=substr($textData,$strposNum+3,100);}
        $Arr['text']=$textData;
        $Arr['twNum']=$twNum;

        $benguadata=M()->query("select {$sgua} from tb_shangxiaguacx where name='{$xgua}'");
        //$arrbengua=M()->query("select name,hugua from tb_zy_lssgua where name='{$benguadata[0][$sgua]}'");
        $Arr['name']=$benguadata[0][$sgua];

        return $Arr;
    }
    public function tbssYhysData($sizhu,$type=null,$twNum1=null,$twNum2=null){//元会运世（皇极取数法） //9715  2101
        $Gyname=mb_substr($sizhu[0],0,1,'utf-8');$Zyname=mb_substr($sizhu[0],1,1,'utf-8');
        $Gmname=mb_substr($sizhu[1],0,1,'utf-8');$Zmname=mb_substr($sizhu[1],1,1,'utf-8');
        $Gdname=mb_substr($sizhu[2],0,1,'utf-8');$Zdname=mb_substr($sizhu[2],1,1,'utf-8');
        $Ghname=mb_substr($sizhu[3],0,1,'utf-8');$Zhname=mb_substr($sizhu[3],1,1,'utf-8');
        $txGNumArr=array(
            '甲'=>'9','乙'=>'8','丙'=>'7','丁'=>'6','戊'=>'5','己'=>'9','庚'=>'8','辛'=>'7','壬'=>'6','癸'=>'5',
        );
        $txZNumArr=array(
            '子'=>'9','丑'=>'8','寅'=>'7','卯'=>'6','辰'=>'5','巳'=>'4','午'=>'9','未'=>'8','申'=>'7','酉'=>'6','戌'=>'5','亥'=>'4',
        );
//        $qNum=($txGNumArr[$Gyname]+$txZNumArr[$Zyname])%10;if($qNum<=0)$qNum=1;
//        $bNum=($txGNumArr[$Gmname]+$txZNumArr[$Zmname])%10;
//        $sNum=($txGNumArr[$Gdname]+$txZNumArr[$Zdname])%10;
//        $gNum=($txGNumArr[$Ghname]+$txZNumArr[$Zhname])%10;
        $ke1=($txGNumArr[$Gyname]+$txZNumArr[$Zyname])*100+($txGNumArr[$Gmname]+$txZNumArr[$Zmname])+($txGNumArr[$Gyname]*1000);
        $ke2num=($txGNumArr[$Gdname]+$txZNumArr[$Zdname])*100+($txGNumArr[$Ghname]+$txZNumArr[$Zhname]);
        $ke2=(substr($ke2num,1,1).substr($ke2num,0,1).substr($ke2num,3,1).substr($ke2num,2,1))+($txGNumArr[$Gyname]*1000);
        //判断符合条文
        if($twNum1){$ke1=$twNum1;}
        if($twNum2){$ke2=$twNum2;}
        if($twNum1&&$type=='2.1'){$ke1=$twNum1-30;}
        if($twNum2&&$type=='2.2'){$ke2=$twNum2-30;}

        $keNumArr=array($ke1,$ke2);
        foreach($keNumArr as $key=>$value){
            if($value>13000){$dataNum=$value-12000;$keNumArr[$key]=$dataNum;
            }elseif($value<1001){$dataNum=$value+12000;$keNumArr[$key]=$dataNum;}
        }

        //dump($keNumArr);

        //输出判断条文
        if($type>2){
            if($type=='2.1'){$numberTw=$keNumArr[0];
            }else{
                $numberTw=$keNumArr[1];
            }
            $twArr=M()->query("select number,content from data_tbss where number='{$numberTw}'");
            $strposNum=strrpos($twArr[0]['content'],'）');
            if($strposNum){
                $twArr[0]['content']=substr($twArr[0]['content'],$strposNum+3,100);
            }
            return $twArr[0];
        }

        $ke1=$keNumArr[0];
        $ke2=$keNumArr[1];
        $ke1ArrNum=array(
            $ke1+$txGNumArr[$Gmname]*100,
            $ke1+$txGNumArr[$Gdname]*10,
            $ke1+$txGNumArr[$Ghname],
            $ke1+$txGNumArr[$Gdname],

        );
        foreach($ke1ArrNum as $key=>$value){
            if($value>13000){$value-=12000;}
            $twArr=M()->query("select * from data_tbss where number='{$value}'");
            $dataArr[$key]=$twArr[0]['content'];
        }
        $ke2ArrNum=array(
            $ke2+$txGNumArr[$Gmname]*100,
            $ke2+$txGNumArr[$Gdname]*10,
            $ke2+$txGNumArr[$Ghname],
            $ke2+$txGNumArr[$Gdname],
        );
        foreach($ke2ArrNum as $key=>$value){
            if($value>13000){$value-=12000;}
            $twArr=M()->query("select * from data_tbss where number='{$value}'");
            $dataArr2[$key]=$twArr[0]['content'];
        }
        $Arr=array_merge($dataArr,$dataArr2);
        foreach($Arr as $key=>$value){
            $strposNum=strrpos($value,'）');
            if($strposNum){
                $Arr[$key]=substr($value,$strposNum+3,100);
            }
        }
        return $Arr;
    }
    public function tbssLndyData($sizhu,$ymd,$hour){//流年大运取数
        $Gyname=mb_substr($sizhu[0],0,1,'utf-8');$Zyname=mb_substr($sizhu[0],1,1,'utf-8');
        $Gmname=mb_substr($sizhu[1],0,1,'utf-8');$Zmname=mb_substr($sizhu[1],1,1,'utf-8');
        $Gdname=mb_substr($sizhu[2],0,1,'utf-8');$Zdname=mb_substr($sizhu[2],1,1,'utf-8');
        $Ghname=mb_substr($sizhu[3],0,1,'utf-8');$Zhname=mb_substr($sizhu[3],1,1,'utf-8');
        $txGNumArr=array(
            '甲'=>4,'乙'=>4,'丙'=>6,'丁'=>3,'戊'=>3,'己'=>4,'庚'=>4,'辛'=>6,'壬'=>3,'癸'=>3,
        );
        $txZNumArr=array('子'=>1,'丑'=>5,'寅'=>3,'卯'=>3,'辰'=>5,'巳'=>2,'午'=>2,'未'=>5,'申'=>4,'酉'=>4,'戌'=>5,'亥'=>1,);
        $txZNumArr2=array('子'=>6,'丑'=>10,'寅'=>8,'卯'=>8,'辰'=>10,'巳'=>7,'午'=>7,'未'=>10,'申'=>9,'酉'=>9,'戌'=>10,'亥'=>6,);
        $qNum=$txGNumArr[$Gyname];
        $bNum=$txGNumArr[$Gmname]*1000;
        $sNum=$txGNumArr[$Gdname]*100;
        $gNum=$txGNumArr[$Ghname]*10;
        $jcNum=$qNum+$bNum+$sNum+$gNum;

        //11-50流年数据获取
        $lsjiazi=array('甲子','乙丑','丙寅','丁卯','戊辰','己巳','庚午','辛未','壬申','癸酉','甲戌','乙亥','丙子','丁丑','戊寅','己卯','庚辰','辛巳','壬午','癸未'
        ,'甲申','乙酉','丙戌','丁亥','戊子','己丑','庚寅','辛卯','壬辰','癸巳','甲午','乙未','丙申','丁酉','戊戌','己亥','庚子','辛丑','壬寅','癸卯'
        ,'甲辰','乙巳','丙午','丁未','戊申','己酉','庚戌','辛亥','壬子','癸丑','甲寅','乙卯','丙辰','丁巳','戊午','己未','庚申','辛酉','壬戌','癸亥');

        $ymdArr=explode('-',$ymd);
        $lyQd=$ymdArr[0]+10;
        $lnYmd=$lyQd.'-'.$ymdArr[1].'-'.$ymdArr[2];
        zwmp($lnYmd,$hour,'男','sizhu');
        $Lnsizhu=I('globals.sizhu');//Z四柱
        $ng=$Lnsizhu[0];
        $dayungznum=array_search($ng,$lsjiazi);

        $LNgzArr=array();$LNlfArr=array();
        for($i=0;$i<40;$i++){
            $datanum=$dayungznum+$i;
            $datanum=$datanum%60;
            $dayunbz=$lsjiazi[$datanum];
            array_push($LNgzArr,$dayunbz);array_push($LNlfArr,$lyQd+$i);
        }
        $twNumArr=array();
        foreach($LNgzArr as $key=>$value){
            $typeNum=0;
            $vG=mb_substr($value,0,1,'utf-8');
            $vZ=mb_substr($value,1,1,'utf-8');
            if($key>20){
                $twNum=$jcNum+($txGNumArr[$vG]*1000)+$txZNumArr2[$vZ];
            }else{
                $twNum=$jcNum+($txGNumArr[$vG]*1000)+$txZNumArr[$vZ];
            }
            foreach($twNumArr as $k=>$v){//相同数字处理
                if($v==$twNum){
                    $twNum+=$LNlfArr[$key];
                    if($twNum>13000)$twNum-=12000;
                    //dump($v.'__'.$twNum);
                    array_push($twNumArr,$twNum);
                    $typeNum=1;
                    break;
                }
            }
            if(empty($typeNum)){
                array_push($twNumArr,$twNum);
            }
        }

        $condtion='';
        foreach($twNumArr as $key=>$value){
            if($key>0){
                $condtion.=" or number={$value}";
            }else{
                $condtion="number={$value}";
            }
        }
        $tbssArr=M()->query("select number,content from data_tbss where {$condtion}");
        $Arr=array();
        foreach($twNumArr as $key=>$value){
            foreach($tbssArr as $k=>$v){
                if($v['number']==$value){
                    $dataArr['number']=$value;
                    $age=$key+11;
                    $dataArr['xs']="虚岁".$age;

                    $strposNum=strrpos($v['content'],'）');
                    if($strposNum){$v['content']=substr($v['content'],$strposNum+3,100);}
                    $dataArr['content']=$v['content'];
                    array_push($Arr,$dataArr);
                }
            }
        }
//        dump($Arr);
        return $Arr;
    }





    //徐氏铁板
    public function xsTbss($sizhu,$dayungz,$sexNum){
        //$sizhu=array('丙子','壬辰','庚申','甲申');
        //dump($sizhu);
        cookie('sexNum',$sexNum);

        $yyNum=array('甲'=>1,'丙'=>1,'戊'=>1,'庚'=>1,'壬'=>1,);//阴阳
        $ng=mb_substr($sizhu[0],0,1,'utf-8');
        if($yyNum[$ng]==1){
            cookie('yynum',1);
        }else{
            cookie('yynum',0);
        }

        //太玄数
        $txGNumArr=array('甲'=>'9','乙'=>'8','丙'=>'7','丁'=>'6','戊'=>'5','己'=>'9','庚'=>'8','辛'=>'7','壬'=>'6','癸'=>'5',);
        $txZNumArr=array('子'=>'9','丑'=>'8','寅'=>'7','卯'=>'6','辰'=>'5','巳'=>'4','午'=>'9','未'=>'8','申'=>'7','酉'=>'6','戌'=>'5','亥'=>'4',);

        $bgjzData=$this->tbssBs2Data($sizhu);//八卦加则法
        $sztxArr=$this->sztxNum($sizhu,$txGNumArr,$txZNumArr);//四柱太玄数
        $bmGua=$this->bmYmdhGua($sizhu);//本命卦获取

        //对不上    1924-1983为中元
        $smbsData=$this->smbsXs($sizhu,$sztxArr,$txGNumArr,$txZNumArr);//四门变数
        $bggfData=$this->bggfQsXs($sztxArr);//八卦滚法
        $xhtqsData=$this->xthtqsXs($sizhu);//先、后天取数
        $xhqxData=$this->xhtgqsXs($xhtqsData['xtGua'],$xhtqsData['htGua']);//先后天卦取数
        $qhgqsData=$this->qhgqsXs($sztxArr);//前后卦取数法

        $tgqsData=$this->tgqsXs($sizhu);//天干取数
        $rgqsData=$this->rgqsXs($bgjzData[2]['twNum']);//日卦取数
        $txqsData=$this->txqsXs($bmGua,$txGNumArr,$txZNumArr);//太玄取数
        $gzqsData=$this->gzqsXs($sztxArr);//卦中取数
        $dyqsData=$this->dyqsXs($sizhu,$dayungz);//大运取数
        $lnqsData=$this->lnqsXs($sizhu);//流年取数

        $Arr=array(
            'bmGua'=>$bmGua,
            'data'=>array(
                'xtqs'=>$xhtqsData['xtqs'],
                'htqs'=>$xhtqsData['htqs'],
                'xhqs'=>$xhqxData,
                'qhqs'=>$qhgqsData,
                'bggf'=>$bggfData,
                'smbs'=>$smbsData,

                'txqs'=>$txqsData,
                'tgqs'=>$tgqsData,
                'rgqs'=>$rgqsData,
                'gzqs'=>$gzqsData,
                'dyqs'=>$dyqsData,
                'lnqs'=>$lnqsData,
            ),
        );
        dump($Arr);exit;
    }
    function smbsXs($sizhu,$sztxArr,$txGNumArr,$txZNumArr){//四门变数
        $GNumArr=array('甲'=>6,'乙'=>2,'丙'=>8,'丁'=>7,'戊'=>1,'己'=>9,'庚'=>3,'辛'=>4,'壬'=>6,'癸'=>2,);
        $ZNumArr=array('子'=>'1,6','丑'=>'5,10','寅'=>'3,8','卯'=>'3,8','辰'=>'5,10','巳'=>'2,7','午'=>'2,7','未'=>'5,10','申'=>'4,9','酉'=>'4,9','戌'=>'5,10','亥'=>'1,6',);
        $strNumArr=array();
        foreach($sizhu as $key=>$value){
            $Tg=mb_substr($value,0,1,'utf-8');$Dz=mb_substr($value,1,1,'utf-8');
            array_push($strNumArr,$GNumArr[$Tg]);
            $dzArr=explode(',',$ZNumArr[$Dz]);
            array_push($strNumArr,$dzArr[0],$dzArr[1]);
        }
        $Tnum=0;$Dnum=0;
        foreach($strNumArr as $key=>$value){
            if($value%2==0){
                $Dnum+=$value;
            }else{
                $Tnum+=$value;
            }
        }
        $Tnum%=8;if($Tnum<1)$Tnum=8;
        $Dnum%=8;if($Dnum<1)$Dnum=8;
        $gua=$this->bgjzXs($Tnum,$Dnum,1);
        $num1=$this->bggfQsXs_ps($gua[0],1);$num2=$this->bggfQsXs_ps($gua[1],2);
        $jbsData=$num1+$num2;//基本数
        $huGua=$this->tbssTaowenNum($gua[0],$gua[1],2);//获取互卦
        $gua1=$huGua['hugua'];
        $gua2=$this->bggfQsXs_yb($jbsData,$gua1,$sztxArr,9);
        $gua3=$this->smbsXs_yy($gua1);$gua4=$this->smbsXs_yy($gua2);
        $guaArr=array($gua1,$gua2,$gua3,$gua4);
        foreach($guaArr as $key=>$value){
            $strSz=$this->smbsXs_ghgz($value);
            $smSzArr[$key]=$strSz;
        }
        $sztxArr=$this->sztxNum($smSzArr,$txGNumArr,$txZNumArr);//四柱太玄数
        $Arr=array();
        foreach($sztxArr as $key=>$value){
            $miNum=$value[0].$value[1];
            $countNumArr=array(
                $miNum*19-7, $miNum*37-7, $miNum*53-7, $miNum*79-7, $miNum*103-7, $miNum*237-7,
            );
            foreach($countNumArr as $k=>$v){
                if($v>13000)$countNumArr[$k]-=12000;
            }
            $Arr=array_merge($Arr,$countNumArr);
        }
        return $Arr;
    }
    function smbsXs_ghgz($gua){//卦化干支 得秘数
        $yyNum=cookie('yynum');//1为阳 0为阴
        //天干配卦  日主配卦
        $GNumArr=array('甲'=>1,'乙'=>8,'丙'=>7,'丁'=>2,'戊'=>6,'己'=>3,'庚'=>4,'辛'=>5,'壬'=>1,'癸'=>8,);
        $ZNumArr=array('子'=>6,'丑'=>8,'寅'=>4,'卯'=>4,'辰'=>2,'午'=>3,'巳'=>3,'未'=>7,'申'=>1,'酉'=>1,'戌'=>5,'亥'=>6,);
        $numArr=$this->tbssTaowenNum(substr($gua,3,3),substr($gua,0,3),4);
        foreach($GNumArr as $key=>$value){
            if($value==$numArr[0]){
                if($value==1){
                    if($yyNum==1){$gData='壬';}else{$gData='甲';}
                }else if($value==8){
                    if($yyNum==1){$gData='癸';}else{$gData='乙';}
                }else{
                    $gData=$key;
                }
            }
        }
        $dzArr=array();
        foreach($ZNumArr as $key=>$value){
            if($value==$numArr[1]){
                array_push($dzArr,$key);
            }
        }
        foreach($dzArr as $key=>$value){
            if($key>=1){
                if($yyNum<1)$zData=$value;
            }else{
                $zData=$value;
            }
        }
        $gzStr=$gData.$zData;
        return $gzStr;
    }
    function smbsXs_yy($gua){//阴阳颠倒
        $yaoArr=str_split($gua);
        $strGua='';
        foreach($yaoArr as $key=>$value){
            if($value>1){$value-=1;
            }else{$value+=1;
            }
            $strGua.=$value;
        }
        return $strGua;
    }
    function bggfQsXs($sztxArr){//八卦滚法
        $numArr=array();
        foreach($sztxArr as $ket=>$value){
            array_push($numArr,$value[0]);array_push($numArr,$value[1]);
        }
        $jiNum=0;$ouNum=0;
        foreach($numArr as $key=>$value){
            if($value%2){//奇数
                $jiNum+=$value;
            }else{
                $ouNum+=$value;
            }
        }
        $jiNum%=8;if($jiNum<=0)$jiNum=8;
        $ouNum%=8;if($ouNum<=0)$ouNum=8;

        $jbgArr=$this->xhtBasicNum($jiNum,$ouNum);
        $sgStr=substr($jbgArr['guaYao'],3,3);$xgStr=substr($jbgArr['guaYao'],0,3);
        $guaArr=$this->tbssTaowenNum($sgStr,$xgStr,2);//获取互卦
        $gua1=$guaArr['hugua'];
        $num1=$this->bggfQsXs_ps($sgStr,1);$num2=$this->bggfQsXs_ps($xgStr,2);
        $jbsData=$num1+$num2;//基本数
        $gua2=$this->bggfQsXs_yb($jbsData,$gua1,$sztxArr,9);
        $guaArr3=$this->tbssTaowenNum(substr($gua1,3,3),substr($gua1,0,3),2);//获取互卦
        $gua3=$guaArr3['hugua'];
        $guaArr4=$this->tbssTaowenNum(substr($gua2,3,3),substr($gua2,0,3),2);//获取互卦
        $gua4=$guaArr4['hugua'];

        $yuArr=$this->bggfQsXs_yb($jbsData,$gua1,$sztxArr,6);
        $gua5=$this->bggfQsXs_dd($gua1,$yuArr);
        $gua6=$this->bggfQsXs_dd($gua2,$yuArr);
        $gua7=$this->bggfQsXs_dd($gua3,$yuArr);
        $gua8=$this->bggfQsXs_dd($gua4,$yuArr);

        $guaArr=array(
            'gua1'=>$gua1,
            'gua2'=>$gua2,
            'gua3'=>$gua3,
            'gua4'=>$gua4,
            'gua5'=>$gua5,
            'gua6'=>$gua6,
            'gua7'=>$gua7,
            'gua8'=>$gua8,
        );
        $twArr=array();
        foreach($guaArr as $key=>$value){
            $VsgStr=substr($value,3,3);$VxgStr=substr($value,0,3);
            $xsNum1=$this->xhtgqsXs_bgqs($VsgStr,1);$xsNum2=$this->xhtgqsXs_bgqs($VxgStr,1);
            $xtNum1=$this->xhtgqsXs_bgqs($VsgStr,3);$xtNum2=$this->xhtgqsXs_bgqs($VxgStr,2);
            $htNum1=$this->xhtgqsXs_bgqs($VsgStr,2);$htNum2=$this->xhtgqsXs_bgqs($VxgStr,4);
            $numArr=array($xsNum1.$xsNum2,$xtNum1.$xtNum2,$htNum1.$htNum2);
            $num1=$numArr[0];$num2=$numArr[1];$num3=$numArr[2];
            $tw1=$num1*100+$num2;$tw2=$num1*100+$num3;
            $tw3=$num2*100+$num1;$tw4=$num2*100+$num3;
            $tw5=$num3*100+$num1;$tw6=$num3*100+$num2;
            array_push($twArr,$tw1,$tw2,$tw3,$tw4,$tw5,$tw6);
        }
        return $twArr;
    }
    function bggfQsXs_dd($gua,$ybArr){//上下卦颠倒
        $yaoArr=str_split($gua);
        $strGua='';
        foreach($yaoArr as $key=>$value){
            if($ybArr[$key]==1){
                if($value>1){$value-=1;
                }else{$value+=1;
                }
            }
            $strGua.=$value;
        }
        return substr($strGua,3,3).substr($strGua,0,3);
    }
    function bggfQsXs_yb($jbsData,$gua,$sztxArr,$remainder){//爻变
        $ymd=cookie('ymd');$ymdArr=explode('-',$ymd);$y=$ymdArr[0];
        $yysex=cookie('yysex');
        $yaoArr=str_split($gua);
        $ngTx=$sztxArr[0][0];$nzTx=$sztxArr[0][1];
        if($y<=1983){//中元
            if($yysex=='阳男'||$yysex=='阴女'){
                $ngTx*=100;$nzTx*=10;
            }else{
                $ngTx*=10;$nzTx*=100;
            }
        }else{
            $nzTx*=10;
        }
        $yuNum=($jbsData+$ngTx+$nzTx)%$remainder;
        if($yuNum==1){
            $ybArr=array(1,0,0,0,0,0);
        }else if($yuNum==2){$ybArr=array(0,1,0,0,0,0);
        }else if($yuNum==3){$ybArr=array(0,0,1,0,0,0);
        }else if($yuNum==4){$ybArr=array(0,0,0,1,0,0);
        }else if($yuNum==5){$ybArr=array(0,0,0,0,1,0);
        }else if($yuNum==6){$ybArr=array(0,0,0,1,1,1);
        }else if($yuNum==7){$ybArr=array(1,0,0,1,0,0);
        }else if($yuNum==8){$ybArr=array(0,1,0,0,1,0);
        }else{$ybArr=array(0,0,1,1,1,1);
        }

        if($remainder==6){return $ybArr;}

        $strGua='';
        foreach($yaoArr as $key=>$value){
            if($ybArr[$key]==1){
                if($value>1){$value-=1;
                }else{$value+=1;
                }
            }
            $strGua.=$value;
        }
        return $strGua;
    }
    function bggfQsXs_ps($strGua,$type){//八卦基本配数表  type为1上卦  2下卦
        if($strGua=='111'){$sgNum=180;$xgNum=450;  //乾天
        }else if($strGua=='112'){$sgNum=720;$xgNum=990; //兑泽
        }else if($strGua=='121'){$sgNum=1260;$xgNum=1530;  //离火
        }else if($strGua=='122'){$sgNum=1800;$xgNum=2070; //震雷
        }else if($strGua=='211'){$sgNum=2340;$xgNum=2610;  //巽风
        }else if($strGua=='212'){$sgNum=2880;$xgNum=3150;  //坎水
        }else if($strGua=='221'){$sgNum=3420;$xgNum=3690; //艮山
        }else if($strGua=='222'){$sgNum=3960;$xgNum=4230;  //坤地
        }
        if($type==1){
            return $sgNum;
        }else{
            return $xgNum;
        }
    }
    function qhgqsXs($sztxArr){//前后卦取数法
        foreach($sztxArr as $key=>$value){
            $num=($value[0]+$value[1])%8;if($num<0)$num=8;
            $yuNumArr[$key]=$num;
        }

        $qgJcs=$this->bgjzXs($yuNumArr[0],$yuNumArr[1]);
        $hgJcs=$this->bgjzXs($yuNumArr[2],$yuNumArr[3]);
        $Arr=array();
        for($i=1;$i<=4;$i++){
            $num1=$qgJcs+96*$i;
            array_push($Arr,$num1);
        }
        for($i=1;$i<=4;$i++){
            $num1=$hgJcs-96*$i;if($num1<1000)$num1+=12000;
            array_push($Arr,$num1);
        }
        return $Arr;
    }
    function bgjzXs($sgNum,$xgNum,$typenum=null){//前后  八卦加则法
        if($sgNum==5){$sgua='qiantian';$qNum=5*1000;$guaSstr='111';
        }else if($sgNum==6){$sgua='duize';$qNum=6*1000;$guaSstr='112';
        }else if($sgNum==8){$sgua='lihuo';$qNum=8*1000;$guaSstr='121';
        }else if($sgNum==3){$sgua='zhenlei';$qNum=3*1000;$guaSstr='122';
        }else if($sgNum==4){$sgua='xunfeng';$qNum=4*1000;$guaSstr='211';
        }else if($sgNum==1){$sgua='kanshui';$qNum=1*1000;$guaSstr='212';
        }else if($sgNum==7){$sgua='genshan';$qNum=7*1000;$guaSstr='221';
        }else if($sgNum==2){$sgua='kundi';$qNum=2*1000;$guaSstr='222';
        }
        if($xgNum==5){$xgua='乾天';$xGuaNum=5; $guaXstr='111';
        }else if($xgNum==6){$xgua='兑泽';$xGuaNum=6;$guaXstr='112';
        }else if($xgNum==8){$xgua='离火';$xGuaNum=8;$guaXstr='121';
        }else if($xgNum==3){$xgua='震雷';$xGuaNum=3;$guaXstr='122';
        }else if($xgNum==4){$xgua='巽风';$xGuaNum=4;$guaXstr='211';
        }else if($xgNum==1){$xgua='坎水';$xGuaNum=1;$guaXstr='212';
        }else if($xgNum==7){$xgua='艮山';$xGuaNum=7;$guaXstr='221';
        }else if($xgNum==2){$xgua='坤地';$xGuaNum=2;$guaXstr='222';
        }
        if($typenum==1){
            return array($guaSstr,$guaXstr);
        }
        $jzArr=array(0,30,90,180,300,450,630);
        $yangCount=substr_count($guaSstr.$guaXstr,1);
        $yinCount=substr_count($guaSstr.$guaXstr,2);
        $twNum=$qNum+$jzArr[$yangCount]+$jzArr[$yinCount]-$xGuaNum;
        return $twNum;
    }
    function xhtgqsXs($xtGua,$htGua){//先后天卦取数
        $xtSgua=substr($xtGua,0,3);$xtXgua=substr($xtGua,3,3);
        $xtSnum1=$this->xhtgqsXs_bgqs($xtSgua,1);
        $xtSnum2=$this->xhtgqsXs_bgqs($xtXgua,1);
        $xtHGNumArr=$this->tbssTaowenNum($xtSgua,$xtXgua,1);
        $xtJbs=$xtSnum1.$xtSnum2.$xtHGNumArr[0].$xtHGNumArr[1];

        $htSgua=substr($htGua,0,3);$htXgua=substr($htGua,3,3);
        $htSnum1=$this->xhtgqsXs_bgqs($htSgua,2);
        $htSnum2=$this->xhtgqsXs_bgqs($htXgua,2);
        $htHGNumArr=$this->tbssTaowenNum($htSgua,$htXgua,3);
        $htJbs=$htSnum1.$htSnum2.$htHGNumArr[0].$htHGNumArr[1];

        $xtArr=array();$htArr=array();
        for($i=2;$i<=16;$i*=2){
            $Inum1=$xtJbs+48*$i;
            array_push($xtArr,$Inum1);
            $Inum2=$htJbs+48*$i;
            array_push($htArr,$Inum2);
        }
        for($i=2;$i<=16;$i*=2){
            $Inum1=$xtJbs-48*$i;if($Inum1<1000)$Inum1+=12000;
            array_push($xtArr,$Inum1);
            $Inum2=$htJbs-48*$i;if($Inum2<1000)$Inum2+=12000;
            array_push($htArr,$Inum2);
        }

        $Arr=array_merge($xtArr,$htArr);
        return $Arr;
    }
    function xhtgqsXs_bgqs($strGua,$type){//八卦 取 1先天序号 2后天数 3先天数得
        //四种： 1.乾一、兑二、离三、震四、巽五、坎六、艮七、坤八。 2.坎一、坤二、震三、巽四、中五、乾六、兑七、艮八、离九。 3.坤一、巽二、离三、兑四、中五、艮六、坎七、震八、乾九。 4. 震一、巽二、离三、坤四、兑五、乾六、坎七、艮八。 四种卦序，
        if($strGua=='111'){$BGNum1=1;$BGNum2=6;$BGNum3=9;$BGNum4=6;  //乾天
        }else if($strGua=='112'){$BGNum1=2;$BGNum2=7;$BGNum3=4;$BGNum4=5;  //兑泽
        }else if($strGua=='121'){$BGNum1=3;$BGNum2=9;$BGNum3=3;$BGNum4=3;  //离火
        }else if($strGua=='122'){$BGNum1=4;$BGNum2=3;$BGNum3=8;$BGNum4=1;  //震雷
        }else if($strGua=='211'){$BGNum1=5;$BGNum2=4;$BGNum3=2;$BGNum4=2;  //巽风
        }else if($strGua=='212'){$BGNum1=6;$BGNum2=1;$BGNum3=7;$BGNum4=7;  //坎水
        }else if($strGua=='221'){$BGNum1=7;$BGNum2=8;$BGNum3=6;$BGNum4=8;  //艮山
        }else if($strGua=='222'){$BGNum1=8;$BGNum2=2;$BGNum3=1;$BGNum4=4;  //坤地
        }
        if($type==1){
            return $BGNum1;
        }elseif($type==2){
            return $BGNum2;
        }elseif($type==3){
            return $BGNum3;
        }else{
            return $BGNum4;
        }
    }
    function txqsXs($bmGua,$txGNumArr,$txZNumArr){
        foreach($bmGua as $key=>$value){
            $s6num1=mb_substr($value['sxgua6'],2,1,'utf-8');$s6num2=mb_substr($value['sxgua6'],3,1,'utf-8');
            $s6sum=$txGNumArr[$s6num1]+$txZNumArr[$s6num2];
            $s5num1=mb_substr($value['sxgua5'],2,1,'utf-8');$s5num2=mb_substr($value['sxgua5'],3,1,'utf-8');
            $s5sum=$txGNumArr[$s5num1]+$txZNumArr[$s5num2];
            $s4num1=mb_substr($value['sxgua4'],2,1,'utf-8');$s4num2=mb_substr($value['sxgua4'],3,1,'utf-8');
            $s4sum=$txGNumArr[$s4num1]+$txZNumArr[$s4num2];
            $s3num1=mb_substr($value['sxgua3'],2,1,'utf-8');$s3num2=mb_substr($value['sxgua3'],3,1,'utf-8');
            $s3sum=$txGNumArr[$s3num1]+$txZNumArr[$s3num2];
            $s2num1=mb_substr($value['sxgua2'],2,1,'utf-8');$s2num2=mb_substr($value['sxgua2'],3,1,'utf-8');
            $s2sum=$txGNumArr[$s2num1]+$txZNumArr[$s2num2];
            $s1num1=mb_substr($value['sxgua1'],2,1,'utf-8');$s1num2=mb_substr($value['sxgua1'],3,1,'utf-8');
            $s1sum=$txGNumArr[$s1num1]+$txZNumArr[$s1num2];
            $sunArr=array($s6sum,$s5sum,$s4sum,$s3sum,$s2sum,$s1sum);
            foreach($sunArr as $k=>$v){
                if($v==10){$sunArr[$k]=0;}
            }
            $arrNum1=$sunArr[0]+$sunArr[1]+$sunArr[2];
            $arrNum2=$sunArr[3]+$sunArr[4]+$sunArr[5];
            $Arr[$key]=$arrNum1.$arrNum2;
        }
        return $Arr;
    }
    function bmYmdhGua($sizhu){//本命卦获取
        $ng=mb_substr($sizhu[0],0,1,'utf-8');$nz=mb_substr($sizhu[0],1,1,'utf-8');
        $yg=mb_substr($sizhu[1],0,1,'utf-8');$yz=mb_substr($sizhu[1],1,1,'utf-8');
        $rg=mb_substr($sizhu[2],0,1,'utf-8');$rz=mb_substr($sizhu[2],1,1,'utf-8');
        $sg=mb_substr($sizhu[3],0,1,'utf-8');$sz=mb_substr($sizhu[3],1,1,'utf-8');
        //1.乾天 2.兑泽 3.离火 4.震雷 5.巽风 6.坎水 7.艮山 8.坤地
        //天干配卦  日主配卦
        $GNumArr=array('甲'=>1,'乙'=>8,'丙'=>7,'丁'=>2,'戊'=>6,'己'=>3,'庚'=>4,'辛'=>5,'壬'=>1,'癸'=>8,);
        $ZNumArr=array('子'=>6,'丑'=>8,'寅'=>4,'卯'=>4,'辰'=>2,'巳'=>3,'午'=>3,'未'=>7,'申'=>1,'酉'=>1,'戌'=>5,'亥'=>6,);

        $nGua=$this->tbssTaowenNum($GNumArr[$ng],$ZNumArr[$nz],2);
        $yGua=$this->tbssTaowenNum($GNumArr[$yg],$ZNumArr[$yz],2);
        $rGua=$this->tbssTaowenNum($GNumArr[$rg],$ZNumArr[$rz],2);
        $sGua=$this->tbssTaowenNum($GNumArr[$sg],$ZNumArr[$sz],2);
        $arr=array(
            $nGua,$yGua,$rGua,$sGua
        );
        return $arr;
    }
    function lnqsXs($sizhu){//流年取数
        $GNumArr=array('甲'=>4,'乙'=>4,'丙'=>6,'丁'=>3,'戊'=>3,'己'=>4,'庚'=>4,'辛'=>6,'壬'=>3,'癸'=>3,);
        $ZNumArr=array('子'=>'1,6','丑'=>'5,10','寅'=>'3,8','卯'=>'3,8','辰'=>'5,10','巳'=>'2,7','午'=>'2,7','未'=>'5,10','申'=>'4,9','酉'=>'4,9','戌'=>'5,10','亥'=>'1,6',);
        $jbNum=cookie('jbNum');

        //11-50流年数据获取
        $lsjiazi=array('甲子','乙丑','丙寅','丁卯','戊辰','己巳','庚午','辛未','壬申','癸酉','甲戌','乙亥','丙子','丁丑','戊寅','己卯','庚辰','辛巳','壬午','癸未'
        ,'甲申','乙酉','丙戌','丁亥','戊子','己丑','庚寅','辛卯','壬辰','癸巳','甲午','乙未','丙申','丁酉','戊戌','己亥','庚子','辛丑','壬寅','癸卯'
        ,'甲辰','乙巳','丙午','丁未','戊申','己酉','庚戌','辛亥','壬子','癸丑','甲寅','乙卯','丙辰','丁巳','戊午','己未','庚申','辛酉','壬戌','癸亥');
        $ng=$sizhu[0];
        $dayungznum=array_search($ng,$lsjiazi);

        $gzArr=array();
        for($i=0;$i<30;$i++){
            $datanum=$dayungznum+$i;
            $datanum=$datanum%60;
            $dayunbz=$lsjiazi[$datanum];
            array_push($gzArr,$dayunbz);
        }
        $Arr=array();
        foreach($gzArr as $key=>$value){
            $tgV=mb_substr($value,0,1,'utf-8');
            $dzV=mb_substr($value,1,1,'utf-8');
            $qNum=$GNumArr[$tgV]*1000;

            $gNumE=explode(',',$ZNumArr[$dzV]);
            $num1=$jbNum+$qNum+$gNumE[0];
            $num2=$jbNum+$qNum+$gNumE[1];
            array_push($Arr,$num1,$num2);
        }
        return $Arr;
    }
    function dyqsXs($sizhu,$dayungz){//大运取数
        $GNumArr=array('甲'=>4,'乙'=>4,'丙'=>6,'丁'=>3,'戊'=>3,'己'=>4,'庚'=>4,'辛'=>6,'壬'=>3,'癸'=>3,);
        $ZNumArr=array('子'=>'1,6','丑'=>'5,10','寅'=>'3,8','卯'=>'3,8','辰'=>'5,10','巳'=>'2,7','午'=>'2,7','未'=>'5,10','申'=>'4,9','酉'=>'4,9','戌'=>'5,10','亥'=>'1,6',);
        $ng=mb_substr($sizhu[0],0,1,'utf-8');$yg=mb_substr($sizhu[1],0,1,'utf-8');
        $rg=mb_substr($sizhu[2],0,1,'utf-8');$sg=mb_substr($sizhu[3],0,1,'utf-8');
        $jbNum=$GNumArr[$yg].$GNumArr[$rg].$GNumArr[$sg].$GNumArr[$ng];
        cookie('jbNum',$jbNum);

        $Arr=array();
        foreach($dayungz as $key=>$value){
            if($key<8){
                $tgV=mb_substr($value,0,1,'utf-8');
                $dzV=mb_substr($value,1,1,'utf-8');
                $qNum=$GNumArr[$tgV]*1000;
                $gNumE=explode(',',$ZNumArr[$dzV]);
                $num1=$jbNum+$qNum+$gNumE[0];
                $num2=$jbNum+$qNum+$gNumE[1];
                array_push($Arr,$num1,$num2);
            }
        }
        return $Arr;
    }
    function gzqsXs($sztxArr){//卦中取数
        $NsgNum=($sztxArr[0][0]+$sztxArr[0][1])%8;if($NsgNum<=0)$NsgNum=8;
        $YxgNum=($sztxArr[1][0]+$sztxArr[1][1])%8;if($YxgNum<=0)$YxgNum=8;
        $tw1=$this->gzqsXs1($NsgNum,$sztxArr[0][0],$sztxArr[0][1]);
        $huguaXtArr=$this->tbssTaowenNum($NsgNum,$YxgNum,1);
        $tw2=$this->gzqsXs1($NsgNum,$huguaXtArr[0],$huguaXtArr[1]);

        $RsgNum=($sztxArr[2][0]+$sztxArr[2][1])%8;if($RsgNum<=0)$RsgNum=8;
        $SxgNum=($sztxArr[3][0]+$sztxArr[3][1])%8;if($SxgNum<=0)$SxgNum=8;
        $tw3=$this->gzqsXs1($RsgNum,$sztxArr[2][0],$sztxArr[2][1]);

        $huguaXtArr=$this->tbssTaowenNum($RsgNum,$SxgNum,1);
        $tw4=$this->gzqsXs1($RsgNum,$huguaXtArr[0],$huguaXtArr[1]);
        $arr=array($tw1,$tw2,$tw3,$tw4,);
        return $arr;
    }
    function gzqsXs1($NsgNum,$ngtx,$nztx){
        $qNum=$NsgNum+6;
        if($qNum>13){
            $qNum=substr($qNum,1,1);
        }
        return $qNum.$NsgNum.$ngtx.$nztx;
    }
    function sztxNum($sizhu,$txGNumArr,$txZNumArr){//四柱太玄数
        foreach($sizhu as $key=>$value){
            $tg=mb_substr($value,0,1,'utf-8');
            $dz=mb_substr($value,1,1,'utf-8');
            $Arr[$key][0]=$txGNumArr[$tg];
            $Arr[$key][1]=$txZNumArr[$dz];
        }
        return $Arr;
    }
    function tgqsXs($sizhu){//天干取数
        $ng=mb_substr($sizhu[0],0,1,'utf-8');$yg=mb_substr($sizhu[1],0,1,'utf-8');
        $rg=mb_substr($sizhu[2],0,1,'utf-8');$sg=mb_substr($sizhu[3],0,1,'utf-8');
        $pNumArr=array(
            '甲'=>1, '丙'=>2, '戊'=>3, '庚'=>4, '壬'=>5, '乙'=>6, '丁'=>7, '己'=>8, '辛'=>9, '癸'=>0,
        );
        $num=$pNumArr[$yg].$pNumArr[$rg].$pNumArr[$sg].$pNumArr[$ng];
        for($i=1;$i<=4;$i++){
            $arr[$i-1]=$num+(96*$i);
        }
        return $arr;
    }
    function rgqsXs($num){//日卦取数
        for($i=1;$i<=4;$i++){
            $numData=$num-(96*$i);
            if($numData<1000)$numData+=12000;
            $arr[$i-1]=$numData;
        }
        for($i=1;$i<=4;$i++){
            $numData=$num+(96*$i);
            if($numData>13000)$numData-=12000;
            $arr[$i+3]=$numData;
        }
        return $arr;
    }
    function xthtqsXs($sizhu,$typeNum=null){//先天、后天取数       typeNum为1 获取基础数
        $GNumArr=array(
            '甲'=>6,'乙'=>2,'丙'=>8,'丁'=>7,'戊'=>1,'己'=>9,'庚'=>3,'辛'=>4,'壬'=>6,'癸'=>2,
        );
        $ZNumArr=array(
            '子'=>'1,6','丑'=>'5,10','寅'=>'3,8','卯'=>'3,8','辰'=>'5,10','巳'=>'2,7','午'=>'2,7','未'=>'5,10','申'=>'4,9','酉'=>'4,9','戌'=>'5,10','亥'=>'1,6',
        );
        $strNumArr=array();
        foreach($sizhu as $key=>$value){
            $Tg=mb_substr($value,0,1,'utf-8');$Dz=mb_substr($value,1,1,'utf-8');
            array_push($strNumArr,$GNumArr[$Tg]);
            $dzArr=explode(',',$ZNumArr[$Dz]);
            array_push($strNumArr,$dzArr[0],$dzArr[1]);
        }
        $Tnum=0;$Dnum=0;
        foreach($strNumArr as $key=>$value){
            if($value%2==0){
                $Dnum+=$value;
            }else{
                $Tnum+=$value;
            }
        }

        if($Tnum>25){
            $Tnum-=25;
        }else{
            $Tnum=substr($Tnum,1,1);
            if($Tnum>7)$Tnum-=7;
        }
        if($Dnum>30){
            $Dnum-=30;
        }else if($Dnum==30){
            $Dnum=3;
        }else{
            $Dnum=substr($Dnum,1,1);
            if($Dnum>7)$Dnum-=7;
        }
        $Tnum%=8;

        $xtJcsData=$this->xhtBasicNum($Tnum,$Dnum);//先天基础数
        if($typeNum==1){
            return $xtJcsData;
        }
        $htYtyArr=$this->xthtqsXs_yty($xtJcsData['guaYao'],$sizhu);//元堂爻
        $htJcsData=$this->xhtBasicNum($htYtyArr[1],$htYtyArr[0]);//后天取数
        $xtJcsNum=$xtJcsData['number'];$htJcsNum=$htJcsData['number'];
        for($i=1;$i<=4;$i++){
            $Ixtnum=$xtJcsNum+96*$i;$xtArr[$i-1]=$Ixtnum;
            $Ihtnum=$htJcsNum-96*$i;$htArr[$i-1]=$Ihtnum;
        }

        $Arr=array(
            'xtGua'=>$xtJcsData['guaYao'],'htGua'=>$htJcsData['guaYao'],
            'xtqs'=>$xtArr,'htqs'=>$htArr
        );
        return $Arr;
    }

    function xthtqsXs_yty($guaYao,$sizhu){//元堂爻
        $yyNum=array('甲'=>1,'丙'=>1,'戊'=>1,'庚'=>1,'壬'=>1,);//阴阳
        $sg=mb_substr($sizhu[3],0,1,'utf-8');$sz=mb_substr($sizhu[3],1,1,'utf-8');

        $yangCount=substr_count($guaYao,1);
        $yaoArr=str_split($guaYao);
        if($yangCount==1){
            $strYang=array('子丑亥');$strYin=array('寅午','卯未','辰申','巳酉','戌');
        }elseif($yangCount==2){
            $strYang=array('寅子戌','卯丑亥','','','');$strYin=array('辰辰午','巳巳未','申','酉','');
        }elseif($yangCount==3){
            $strYang=array('卯子','辰丑','巳寅','','');$strYin=array('酉午','戌未','亥申','','');
        }elseif($yangCount==4){
            $strYang=array('子戌','丑亥','寅','卯','辰','巳');$strYin=array('申午','酉未','','','');
        }elseif($yangCount==5){
            $strYang=array('子申','丑酉','巳戌','寅亥','卯','辰');$strYin=array('未午','','','','');
        }elseif($yangCount==6){
            $strYang=array('卯子','辰丑','巳寅','酉午','戌未','亥申');
//            if($yyNum[$sg]==1){
//            }else{$strYang=array('','','','酉午','戌未','亥申');
//            }
        }else{
            $strYang=array('卯子','辰丑','巳寅','酉午','戌未','亥申');
//            if($yyNum[$sg]==1){$strYin=array('卯子','辰丑','巳寅','','');
//            }else{$strYin=array('','','','酉午','戌未','亥申');
//            }
        }
        $ArrYtgs=array();
        $keyYang=0;$keyYin=0;
        foreach($yaoArr as $key=>$value){
            if($value==1){//阳
                array_push($ArrYtgs,$strYang[$keyYang]);$keyYang++;
            }else{
                array_push($ArrYtgs,$strYin[$keyYin]);$keyYin++;
            }
        }
        foreach($ArrYtgs as $key=>$value){
            if(substr_count($value,$sz)){
                $yaoNum=$yaoArr[$key];
                $yaoNum= $yaoNum>1?$yaoNum-1:$yaoNum+1;
                $yaoArr[$key]=$yaoNum;
            }
        }
        $strSyao=$yaoArr[3].$yaoArr[4].$yaoArr[5];
        $strXyao=$yaoArr[0].$yaoArr[1].$yaoArr[2];
        $arrYaoStr=array($strSyao,$strXyao);
        foreach($arrYaoStr as $key=>$value){
            if($value=='111'){$arrYaoStr[$key]=6;
            }elseif($value=='112'){$arrYaoStr[$key]=7;
            }elseif($value=='121'){$arrYaoStr[$key]=9;
            }elseif($value=='122'){$arrYaoStr[$key]=3;
            }elseif($value=='211'){$arrYaoStr[$key]=4;
            }elseif($value=='212'){$arrYaoStr[$key]=1;
            }elseif($value=='221'){$arrYaoStr[$key]=8;
            }elseif($value=='222'){$arrYaoStr[$key]=2;
            }
        }
        return $arrYaoStr;
    }
    function xhtBasicNum($sgNum,$xgNum){//先后天基本数  以数化卦
        $sexNum=cookie('sexNum');
        if($sgNum==6){$sgua='qiantian';$qNum=6*1000;$guaSstr='111';
        }else if($sgNum==7){$sgua='duize';$qNum=7*1000;$guaSstr='112';
        }else if($sgNum==9){$sgua='lihuo';$qNum=9*1000;$guaSstr='121';
        }else if($sgNum==3){$sgua='zhenlei';$qNum=3*1000;$guaSstr='122';
        }else if($sgNum==4){$sgua='xunfeng';$qNum=4*1000;$guaSstr='211';
        }else if($sgNum==1){$sgua='kanshui';$qNum=1*1000;$guaSstr='212';
        }else if($sgNum==8){$sgua='genshan';$qNum=8*1000;$guaSstr='221';
        }else if($sgNum==2){$sgua='kundi';$qNum=2*1000;$guaSstr='222';
        }else if($sgNum==5){
            if($sexNum==1){//男
                $sgua='lihuo';$qNum=9*1000;$guaSstr='121';
            }else{
                $sgua='duize';$qNum=7*1000;$guaSstr='112';
            }
        }
        if($xgNum==6){$xgua='乾天';$xGuaNum=6; $guaXstr='111';
        }else if($xgNum==7){$xgua='兑泽';$xGuaNum=7;$guaXstr='112';
        }else if($xgNum==9){$xgua='离火';$xGuaNum=9;$guaXstr='121';
        }else if($xgNum==3){$xgua='震雷';$xGuaNum=3;$guaXstr='122';
        }else if($xgNum==4){$xgua='巽风';$xGuaNum=4;$guaXstr='211';
        }else if($xgNum==1){$xgua='坎水';$xGuaNum=1;$guaXstr='212';
        }else if($xgNum==8){$xgua='艮山';$xGuaNum=8;$guaXstr='221';
        }else if($xgNum==2){$xgua='坤地';$xGuaNum=2;$guaXstr='222';
        }else if($xgNum==5){
            if($sexNum==1){//男
                $xgua='离火';$xGuaNum=9;$guaXstr='121';
            }else{
                $xgua='兑泽';$xGuaNum=7;$guaXstr='112';
            }
        }

        $jzArr=array(0,30,90,180,300,450,630);
        $yangCount=substr_count($guaSstr.$guaXstr,1);
        $yinCount=substr_count($guaSstr.$guaXstr,2);
        $twNum=$qNum+$jzArr[$yangCount]+$jzArr[$yinCount]-$xGuaNum;

        $Arr['number']=$twNum;
        $Arr['guaYao']=$guaXstr.$guaSstr;
        return $Arr;
    }

    public function tbssJg(){
        //命宫评断
        $mgpdArr=array(
            '子'=>'天贵星（子宫立命）其人志气不凡，富裕多吉。子宫之人，乐观积极，文雅动人，平生极少消极及厌世之表现。与人相处，有念旧之深情；夫妇唱随，有持久之厚爱；聪明笃实，有过人之处也。有时标新立异，发激越之言，或于事务判断，独持异议，主观未免过强，致贻性情乖僻之诮。然其意志坚强，为其优点。论事而非论人，不念宿怨，有宽宏大量之风度。如逢岁运不佳，生理方面，可能影响心脏或患血液循环之病、神思厌倦、怔忡不宁等症状。',
            '丑'=>'天厄星（丑宫立命）其人先难后吉，离祖劳心，晚年吉。丑宫之人，志向远大，极喜立功。不计本身利益，好以高傲及教训之态度对人，自觉别人应对自己信任、尊敬、赞美，而不容反对，有时此种举动，或也可致信于人，博得社会一时之敬仰，但其锋芒过露，气焰过张，最后容易遭受怨咎，陷入四面楚歌，足以阻碍其事业之进展。如逢岁运不佳，生理方面，或患风湿、膝部痿弱、流行软脚病及皮肤湿疹等诸症。',
            '寅'=>'天权星（寅宫立命）其人聪明大器，中年有权柄。寅宫之人，秉性刚毅，目光锐利，富有冲刺力，喜觅捷径，以达其目的。其性情活泼，谈吐精神，令人有深刻之印象，虽在童年，已能自见，无论何事，如不能与人共享其成，每歉然于怀，不失为仁者之风度，以是交游甚广，人缘极佳，老谋归隐，也将无法摆脱。如逢岁运不佳，生理方面，可能影响下肢及臀部，如癌瘤痈疽、痰水结聚、崇湿积痈及血液不清等症。',
            '卯'=>'天赦星（卯宫立命）其人慷慨疏财，得意时需谦虚为上。卯宫之人，少时体质较弱，壮年可转强健。当血气方刚时，由于神经过于敏锐，最易动怒，每因小事酿成争端，经历不少挫折。固自成年后，性格一变为严谨，克己自律，以个人力量从事奋斗。其观察力特强，于人于事，能作深度之透视，善恶分明，而于人生之了解，自然界之探索，也有其独特之处。如逢岁运不佳，生理方面，可能影响阴部，发生肾石、痔疮、脱肛、血毒等症。',
            '辰'=>'天如星（辰宫立命）其人事多频频，权略多能。辰宫之人，性情温文，仪表文雅，行行彬彬有礼，乐于为人排解争端，思虑周到，措置均衡，务使单圆能得相应之惬心。遇他人有需求，则挺身出助，常常热忱过度，得空自顾，反而惹起诟谇纠缠。尤以妇人之要求，更睹踊跃以赴，过后若受沉诺之讥，亦所不恤，此类做风，看似随战，缺少决计，其真本性使然。如遇岁运不佳，心理圆面，概略影响肾部，水水不济、脊背薄弱虚弱及患脾肾两盈等症。',
            '巳'=>'天文星（巳宫立命）其人文章振发，女命有好夫。巳宫之人，态度沉静，思虑琐屑，喜吹毛求疵，虽至亲至密者，亦多惧与接近，其为缺点，易生活孤寂。为人注视小节而忽视大局，倘若能轻重适当，则有助其前途。好在立命此宫之人，心细于发，手段精明，处事有条不紊，假如经商做贾，尽能积少成大，前途无量。平时因深思过虑，致易患轻微脑病。如逢岁运不佳，则影响腹部，身患肠胃、便秘、泄泻、痢疾等症。',
            '午'=>'天福星（午宫立命）其人荣华吉命。午宫之人，天生具有高贵的、有野心和热烈的特质。并且有坚强的意志，而且经常不顾险阻，打通一切阻碍的勇气，但有时傲气很盛，行事会很激进，为了出人头地，则又不愿小屈以求大伸。平时待人和蔼可亲，也无非笼络手段，取悦他人，便利其本身之发展。假使戒除骄态，自有成功之日。如逢岁运不佳，生理方面，可能影响腰部，发生脊骨疼痛、风湿、黄疸等症。',
            '未'=>'天驿星（未宫立命）其人一生劳碌，离祖始安。未宫之人，一举一动，于谦让之中每露忸怩之态，似行畏怯，然其性格则敏感而易发怒；貌为柔顺，内心则极坚强，不肯轻易接纳他人意见。其人办事严谨，工作谨慎，均为最佳之表现。并有很好的领悟力与观察力，喜欢沉思，相象力非常活跃，但容易耽于声色之好，宜多注意。如逢岁运不佳，生理方面，可能患胃病、逆呃、消化不良等疾。',
            '申'=>'天孤星（申宫立命）其人不宜早婚，女命妨夫。具有双重性格，心理难得平衡，故有时充满自信乐观，有时则疑虑失望。其可取者，心灵方面极为机警，如讨论谋一问题，每能提出新颖之意见，不同凡响。言论姿态，表露尤佳，故其所发挥之吸引力，足以构成其社会地位。若论事业前途，则应有始有终，不可半途而废。如逢岁运不佳，生理方面，宜防肺胸两部，发生咳嗽、哮喘、气呃及呼吸器官之疾病。',
            '酉'=>'天秘星（酉宫立命）其人性情刚直，时有是非。酉宫之人，沉默宁静，思虑深远，心地善良，忠实可靠，惟有时也表现暴躁，固执己见。其在年少之时，尚未有任性之表现，随着年龄增长，主观日强，积渐日久，行动遂不免放恣，最后得一诤友，随时规劝，定能知所自反，否则流为刚愎自用矣。其人一生富于大自然之爱好，名山大川，乐于登临，其失意时自我恢复能力会很强。生理方面，如逢岁运不佳，可能影响喉部，发生气管炎、心脏不宁等症。',
            '戌'=>'天艺星（戌宫立命）其人心性平和，艺道有名。戌宫之人，举动灵敏，工作热烈，善于进取。对于事务，一经计划就绪，即以全力实施扩展，绝不踌躇顾虑，但缺乏忍耐性，为其所短，故须擅自控制。毋使躁进，遂能步入正轨，取得成功。大凡赋性好动之人，偶受刺激，如非心灰意懒，则将变本加厉，纵结局未必尽败，亦是得不偿失，应以冷静之头脑，作缜密之思考。如逢岁运不佳，生理方面，可能影响头部，如眩晕、中风、思想错乱、牙筋疼痛等疾病。',
            '亥'=>'天寿星（亥宫立命）其人心慈明悟，克己助人。亥宫之人，情感极为浓厚，神经又属敏锐，故待人接物，一片热情，而事逾其分，则已超越于理智之外，反易引起误会，招致他人指责。其人本质，实为谦让为怀，倘能加以修养，务为沉着， 则于世情通达多矣。其生平无视个人财产，愿与亲友同处于恬逸之境，心休意美。如逢岁运不佳，生理方面，可能影响身体全部或因感冒而成痛风症，或因血液有毒而化肿疮，以及关节炎、肢体麻痹等症。',
        );
    }

}